package com.frogs.ucenter.v1.request;

import java.util.Date;

import javax.servlet.http.HttpServletRequest;

import com.frogs.framework.util.StringUtil;
import com.frogs.framework.web.HttpRequestInfo;
import com.frogs.system.util.ApiUrlParamEnum;
import com.frogs.system.util.IdentityTypeEnum;
import com.frogs.system.web.api.request.Request;
import com.frogs.system.web.exception.RequestIllegalException;

public class UserBaseInfoMergeRequest extends Request {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -360656936922665657L;

	private int id;
	private int sex = 0;
	private int age = 0;
	private int userType = 0;
	private int identityType = 0;
	private int defaultContactWay = 0;
	private int height = 0;
	public int getHeight() {
		return height;
	}

	public void setHeight(int height) {
		this.height = height;
	}

	public int getWeight() {
		return weight;
	}

	public void setWeight(int weight) {
		this.weight = weight;
	}

	private int weight = 0;
	
	private String tagIds;
	private String orderPhone;
	private String nickName;
	private String headImageUrl;
	private String realName;
	private String identityCard;
	private String identityVerificationResult;
	private String emergencyContactName;
	private String emergencyPhone;
	private String medicalInsuranceInfo;
	private String offlineUserInfo;
	private String tags;
	private String defaultAddress;
	private String defaultConsignee;
	private String defaultPhone;
	private Date birthday;
	private String diseaseTags;
	
	public UserBaseInfoMergeRequest() {
	}
	
	@Override
	public void parse(HttpServletRequest request) {
		HttpRequestInfo requestInfo = new HttpRequestInfo(request);
		
		this.tagIds = requestInfo.getParameter(ApiUrlParamEnum.tagIds.getParamName());
		
		this.id = requestInfo.getIntParameter(ApiUrlParamEnum.userId.getParamName(), -1);
		if(id <= 0) {
			throw new RequestIllegalException("缺少用户id！");
		}
		
		this.sex = requestInfo.getIntParameter(ApiUrlParamEnum.sex.getParamName(),-1);
		
		this.age = requestInfo.getIntParameter(ApiUrlParamEnum.age.getParamName(), -1);
		
		this.orderPhone = requestInfo.getParameter(ApiUrlParamEnum.orderPhone.getParamName());
		
		this.nickName = StringUtil.fixHtml(requestInfo.getParameter(ApiUrlParamEnum.nickName.getParamName()));
		
		this.headImageUrl = requestInfo.getParameter(ApiUrlParamEnum.headImageUrl.getParamName());
		
		this.userType = requestInfo.getIntParameter(ApiUrlParamEnum.userType.getParamName(), -1);
		
		this.realName = StringUtil.fixHtml(requestInfo.getParameter(ApiUrlParamEnum.realName.getParamName()));
		
		this.identityCard = requestInfo.getParameter(ApiUrlParamEnum.identityCard.getParamName());
		
		this.identityType = requestInfo.getIntParameter(ApiUrlParamEnum.identityType.getParamName(), IdentityTypeEnum.IDCARD.getId());
		
		this.identityVerificationResult = requestInfo.getParameter(ApiUrlParamEnum.identityVerificationResult.getParamName());
		
		this.emergencyContactName = requestInfo.getParameter(ApiUrlParamEnum.emergencyContactName.getParamName());
		
		this.emergencyPhone = requestInfo.getParameter(ApiUrlParamEnum.emergencyPhone.getParamName());
		
		this.medicalInsuranceInfo = requestInfo.getParameter(ApiUrlParamEnum.medicalInsuranceInfo.getParamName());
		
		this.offlineUserInfo = requestInfo.getParameter(ApiUrlParamEnum.offlineUserInfo.getParamName());
		
		this.tags = requestInfo.getParameter(ApiUrlParamEnum.tags.getParamName());
		
		this.defaultAddress = requestInfo.getParameter(ApiUrlParamEnum.defaultAddress.getParamName());
		
		this.defaultConsignee = requestInfo.getParameter(ApiUrlParamEnum.defaultConsignee.getParamName());
		
		this.defaultPhone = requestInfo.getParameter(ApiUrlParamEnum.defaultPhone.getParamName());
		
		this.defaultContactWay = requestInfo.getIntParameter(ApiUrlParamEnum.defaultContactWay.getParamName(), -1);
		
		this.birthday = requestInfo.getDateParameter(ApiUrlParamEnum.birthday.getParamName(), "yyyy-MM-dd");
		
		this.height = requestInfo.getIntParameter(ApiUrlParamEnum.height.getParamName(), -1);
		
		this.weight = requestInfo.getIntParameter(ApiUrlParamEnum.weight.getParamName(), -1);
	
		this.diseaseTags = requestInfo.getParameter(ApiUrlParamEnum.diseaseTag.getParamName(), "");
	}
	
	public int getId() {
		return id;
	}
	
	public void setId(int id) {
		this.id = id;
	}
	
	public String getTagIds() {
		return tagIds;
	}

	public void setTagIds(String tagIds) {
		this.tagIds = tagIds;
	}

	public int getSex() {
		return sex;
	}

	public void setSex(int sex) {
		this.sex = sex;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public int getUserType() {
		return userType;
	}

	public void setUserType(int userType) {
		this.userType = userType;
	}

	public int getIdentityType() {
		return identityType;
	}

	public void setIdentityType(int identityType) {
		this.identityType = identityType;
	}

	public int getDefaultContactWay() {
		return defaultContactWay;
	}

	public void setDefaultContactWay(int defaultContactWay) {
		this.defaultContactWay = defaultContactWay;
	}

	public String getOrderPhone() {
		return orderPhone;
	}

	public void setOrderPhone(String orderPhone) {
		this.orderPhone = orderPhone;
	}

	public String getNickName() {
		return nickName;
	}

	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	public String getHeadImageUrl() {
		return headImageUrl;
	}

	public void setHeadImageUrl(String headImageUrl) {
		this.headImageUrl = headImageUrl;
	}

	public String getRealName() {
		return realName;
	}

	public void setRealName(String realName) {
		this.realName = realName;
	}

	public String getIdentityCard() {
		return identityCard;
	}

	public void setIdentityCard(String identityCard) {
		this.identityCard = identityCard;
	}

	public String getIdentityVerificationResult() {
		return identityVerificationResult;
	}

	public void setIdentityVerificationResult(String identityVerificationResult) {
		this.identityVerificationResult = identityVerificationResult;
	}

	public String getEmergencyContactName() {
		return emergencyContactName;
	}

	public void setEmergencyContactName(String emergencyContactName) {
		this.emergencyContactName = emergencyContactName;
	}

	public String getEmergencyPhone() {
		return emergencyPhone;
	}

	public void setEmergencyPhone(String emergencyPhone) {
		this.emergencyPhone = emergencyPhone;
	}

	public String getMedicalInsuranceInfo() {
		return medicalInsuranceInfo;
	}

	public void setMedicalInsuranceInfo(String medicalInsuranceInfo) {
		this.medicalInsuranceInfo = medicalInsuranceInfo;
	}

	public String getOfflineUserInfo() {
		return offlineUserInfo;
	}

	public void setOfflineUserInfo(String offlineUserInfo) {
		this.offlineUserInfo = offlineUserInfo;
	}

	public String getTags() {
		return tags;
	}

	public void setTags(String tags) {
		this.tags = tags;
	}

	public String getDefaultAddress() {
		return defaultAddress;
	}

	public void setDefaultAddress(String defaultAddress) {
		this.defaultAddress = defaultAddress;
	}

	public String getDefaultConsignee() {
		return defaultConsignee;
	}

	public void setDefaultConsignee(String defaultConsignee) {
		this.defaultConsignee = defaultConsignee;
	}

	public String getDefaultPhone() {
		return defaultPhone;
	}

	public void setDefaultPhone(String defaultPhone) {
		this.defaultPhone = defaultPhone;
	}

	public Date getBirthday() {
		return birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	public String getDiseaseTags() {
		return diseaseTags;
	}

	public void setDiseaseTags(String diseaseTags) {
		this.diseaseTags = diseaseTags;
	}
	
}
